import request from '@/utils/request.js'
// 文章管理相应API
export const getArticleList = (params) => {
  return request.get('/my/article/list',{
    params: params
  })
}
 //新增文章
export const addArticle = (data) => {
  return request.post('/my/article/add',data)
}

// 获取文章详情
export const getArticleDetail = (id) => {
  return request.get('/my/article/info/',{
    params: {
      id
    }
  })
}
// 编辑文章
export const editArticle = (data) => request.put('/my/article/update', data)

// 删除文章
export const delArticle = (id) => request.delete('/my/article/info', { params: { id } })

// 推荐文章
export const recommendArticle = (id) => request.post('/my/article/recommend', { id })

// 取消推荐文章
export const unRecommendArticle = (id) => request.post('/my/article/unRecommend', { id })

// 文章分类相应API
 // 获取文章分类列表
export const getArticleCateList = () => {
  return request.get('/my/cate/list')
}

// 新增文章分类
export const addArticleCate = ({cate_name, cate_alias}) => {
  return request.post('/my/cate/add',{cate_name,cate_alias})
}

// 更新文章分类
export const editArticleCate = ({id, cate_name, cate_alias}) => {
  return request.put(`/my/cate/info`,{id, cate_name,cate_alias})
}

// 删除文章分类
export const deleteArticleCate = (id) => {
  return request.delete(`/my/cate/del`, {
    params: {id}
  })
}
